<template>
  <el-container class="layout-container-demo" style="height: 500px">

    <el-header style="text-align: right; font-size: 12px">
      <div class="toolbar">
        <el-dropdown>
          <el-button>
            你好
          </el-button>
          <!-- <el-icon style="margin-right: 8px; margin-top: 1px">
            <setting />
          </el-icon> -->
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item @click="logout">退出</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-scrollbar>
          <el-menu router unique-opened>
            <el-sub-menu index="1">
              <template #title>
                <el-icon>
                  <message />
                </el-icon>人员管理
              </template>
              <el-menu-item-group>
                <el-menu-item index="appointment">预约管理</el-menu-item>
                <el-menu-item index="case">病例管理</el-menu-item>
                <el-menu-item index="bill">账单管理</el-menu-item>
              </el-menu-item-group>
            </el-sub-menu>
            <el-sub-menu index="2">
              <template #title>
                <el-icon>
                  <Menu />
                </el-icon>医疗用品管理
              </template>
              <el-menu-item-group>
                <el-menu-item index="medicine">药品管理</el-menu-item>
                <el-menu-item index="medicalequipment">器械管理</el-menu-item>
              </el-menu-item-group>
            </el-sub-menu>
            <el-sub-menu index="4">
              <template #title>
                <el-icon>
                  <Menu />
                </el-icon>医生管理
              </template>
              <el-menu-item-group>
                <el-menu-item index="doctor">医生列表</el-menu-item>
              </el-menu-item-group>
            </el-sub-menu>
            <el-sub-menu index="3">
              <template #title>
                <el-icon>
                  <setting />
                </el-icon>系统设置
              </template>
              <el-menu-item-group>
                <el-menu-item index="userconfig">字典管理</el-menu-item>
                <el-menu-item index="account">账号管理</el-menu-item>
                <el-menu-item index="information">个人信息管理</el-menu-item>
              </el-menu-item-group>
            </el-sub-menu>
          </el-menu>
        </el-scrollbar>
      </el-aside>

      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import { Menu as IconMenu, Message, Setting } from '@element-plus/icons-vue'
import { removeStore } from '../libs/storage'

export default{
  methods:{
    logout(){
      removeStore('user');
      removeStore('token');
      this.$router.push('/')
    }
  }
}
</script>

<style>
.layout-container-demo .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}

.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}

.layout-container-demo .el-menu {
  border-right: none;
}

.layout-container-demo .el-main {
  padding: 0;
}

.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>